var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', {title: 'the test for nodejs session'});
});

router.post('/',async(req,res,next) => {
  try {
    const id = res.body.id ;
    console.log(id);
    res.json({
      code:0,
      message:'success'
    })
  } catch (error) {
    console.log(error)
      res.json({
          code: -1,
          message: '服务器错误'
      })
  }
  
});

module.exports = router;
